package ${DTO};

<#list table.importPackages as pkg>
import ${pkg};
</#list>
<#if springdoc>
import io.swagger.v3.oas.annotations.media.Schema;
<#elseif swagger>
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
</#if>
<#if entityLombokModel>
import lombok.Data;
    <#if chainModel>
import lombok.experimental.Accessors;
    </#if>
</#if>
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;

/**
* @description ${table.comment!}更新DTO对象
* @author ${author}
* @time ${date}
*/
<#if entityLombokModel>
@Data
    <#if chainModel>
@Accessors(chain = true)
    </#if>
</#if>
@Builder
@AllArgsConstructor
@NoArgsConstructor
<#if springdoc>
@Schema(name = "${entity}UpdateDTO", description = "${table.comment!}更新DTO对象")
<#elseif swagger>
@ApiModel(value = "${entity}更新DTO对象", description = "${table.comment!}更新DTO对象")
</#if>
public class ${entity}UpdateDTO {

<#-- 只保留主键的非空校验 -->
<#list table.fields as field>
    <#if field.keyFlag>
        <#if field.comment!?length gt 0>
            <#if springdoc>
    @Schema(description = "${field.comment}")
            <#elseif swagger>
    @ApiModelProperty("${field.comment}")
            </#if>
        </#if>
    @NotNull(message = "${field.comment}不能为空")
    private ${field.propertyType} ${field.propertyName};
    </#if>
</#list>

<#-- ----------  BEGIN 字段循环遍历（非主键字段） ---------->
<#list table.fields as field>
    <#if !field.keyFlag>
        <#if field.comment!?length gt 0>
            <#if springdoc>
    @Schema(description = "${field.comment}")
            <#elseif swagger>
    @ApiModelProperty("${field.comment}")
            </#if>
        </#if>
    private ${field.propertyType} ${field.propertyName};

    </#if>
</#list>
<#------------  END 字段循环遍历  ---------->
}